<template>

      <div class="table_review">
      <el-form :model="dataForm" :ref="dataForm">
       
      
      <div class="table_title td_color">尽调详情</div>

         <table class="table_wrap" v-if="dataForm!=undefined">
        <tbody>
          <tr class="tr_height_none" style="height: 0;">
            <td class="table_td td_color">
            </td>
            <td class="table_td">
            </td>
            <td class="table_td td_color">
               
            </td>
            <td class="table_td">
              
            </td>
            <td class="table_td td_color">
                  
            </td>
            <td class="table_td">
             
            </td>
            <td class="table_td td_color">
                 
            </td>
            <td class="table_td">
               
            </td>
           
          </tr>
          <tr class="tr_height">
            <td class="table_td td_color" colspan="1" >
                借款用途说明
            </td>
            <td class="table_td" colspan="11" >
                <el-input type="textarea" :rows="8"  maxlength="400" show-word-limit  v-model="dataForm.borrowUse"/>
            </td>
          </tr>
          <!--第12行  -->
          <tr class="tr_height">
            <td class="table_td td_color" colspan="1">
                客户情况说明
            </td>
            <td  class="table_td" colspan="11">
                <el-input type="textarea"  :rows="8"  maxlength="400" show-word-limit v-model="dataForm.customerOpinion"/>
            </td>
          </tr>
          <!--第13行  -->
          <tr>
            <td class="table_td td_color" colspan="1">
                调查员意见
            </td>
            <td  class="table_td" colspan="11">
                <el-input type="textarea"  :rows="8"  maxlength="400" show-word-limit v-model="dataForm.dueInvestigatorDesc"/>
            </td>
          </tr>
        
        </tbody>
      </table>
      </el-form>
       <!-- v-permission="'system:check-opinion:print'"  -->
        <div style="width:400px;margin:0 auto;margin-top:5%;">
          <el-button v-if="operationLook === undefined" v-permission="'system:check-opinion:edit'"  type="warning" @click="createData" style="width:150px;height:40px;">保存</el-button>
          <el-button type="primary"  v-permission="'system:check-opinion:print'" @click="exportData" style="width:150px;height:40px;">打印</el-button>
        </div>
    </div>


    
 

</template>

<script>
import { findByProjectIdNewReview,editReviewNew,exportReviewNew } from '@/api/review'
import DicSelect from '@/components/select'
  export default {
    components: { DicSelect },
    props:{
      changeValue: undefined,
      taskId: undefined,
      projectId: undefined,
      operationLook: undefined
    },
    data () {
      return {
         headData: "",
         dataForm:{
         }
      }
    },
    created(){
      this.findByProjectId()
    },
    methods: {
      findByProjectId() {
      findByProjectIdNewReview({projectId:this.projectId})
        .then(response => {
          if(response.data != undefined ) {
            this.dataForm = response.data
            
          }
        })
        .catch(() => {
          this.dataForm = undefined
        })
    },
    getValue(index){
      if(index == 1) {
        return "一";
      }
      if(index == 2) {
        return "二";
      }
    },
      createData(){
        this.dataForm.projectId = this.projectId
        editReviewNew(this.dataForm)
            .then(response => {
              this.findByProjectId()
              this.$notify.success({
                title: '成功',
                message: '保存成功'
              })
            })
            .catch(response => {
              this.$notify.error({
                title: '失败',
                message: response.data.message
              })
            })
    },
    exportData() {

        exportReviewNew({projectId: this.projectId})
            .then((res) => {
              const content = res.data
              window.open(content.fileUrl)
            })
            .catch(response => {
              console.log(response)
              this.$notify.error({
                title: '失败',
                message: response.data.message
              })
            })
    },
    }
  }
</script>

<style>


.table_review .el-input__inner{
  height:52px;
  line-height: 55px;
  border:0px solid;
}

.table_review .el-textarea__inner{
  /* height:52px;
  line-height: 55px; */
  border:0px solid;
}

.table_review {
  background-color: #fff;
  width: 100%;
  font-size: 14px;
}
.table_title{
  background-color: #fff;
  border-top: 1px solid #c7c7c7;
  border-right: 1px solid #c7c7c7;
  border-left: 1px solid #c7c7c7;
  width: 100%;
  background-color: #fff;
  text-align: center;
  line-height: 50px;
}
.table_wrap{
  border-collapse: collapse;
  border-spacing: 0px;
  width: 100%;

}

.table_td {
  text-align: center;
  line-height: 50px;  
  min-width: 90px;
  border: 1px solid #c7c7c7;
}
.td_color{
  background-color: #f4f4f4;
}

.tr_height{
  height:100%;
  line-height: 100%;
}
.tr_height_none{
  height:0px;
}
.tr_height_none .table_td{
  height:0px;
  border:none;
}
</style>